<div th:fragment="menu(functionId)" xmlns:th="http://www.thymeleaf.org">
    <!-- Left side column. contains the logo and sidebar -->
    <aside class="main-sidebar">
        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">
            <!-- sidebar menu: : style can be found in sidebar.less -->
            <ul class="sidebar-menu">
                <li class="active treeview">
                    <a href="#">
                        <i class="fa fa-table"></i> <span>新疆跨境后台管理</span> <i class="fa fa-angle-left pull-right"></i>
                    </a>
                    <ul class="treeview-menu">

                    </ul>
                </li>
            </ul>
        </section>
        <!-- /.sidebar -->
    </aside>


    <script type="text/javascript" language="javascript">
        let functionId = [[${functionId}]];
        let base = [[@{/}]];
        $(document).ready(function () {
            $.ajax({
                type: "GET",
                url: "[[@{/user/permit}]]",
                contentType : "application/json",
                success: function (result) {
                    if(result.status==1){
                        result.data.forEach((item,index,arr)=>{
                            if(item.id==functionId)
                            {
                                $(".treeview-menu").append('<li class="active"><a href="'+base+item.url+'"><i class="fa fa-circle-o"></i>'+item.permissionsName+'</a></li>');
                            }else{
                                $(".treeview-menu").append('<li><a href="'+base+item.url+'"><i class="fa fa-circle-o"></i>'+item.permissionsName+'</a></li>');
                            }
                        })
                    }else{
                        console.log(result.message);
                    }
                },
                error: function (e) {
                    console.log("permit menu error");
                    console.log(e);
                }
            });
        });
    </script>
</div>
